package com.eastidea.live.field.singleline;

import net.sf.json.JSONObject;

import com.eastidea.live.entity.FrmInfSingleLineText;
import com.eastidea.live.entity.FrmUiForm;
import com.eastidea.live.ot.FieldOt;

public class SingleLineTextOt {
	public static SingleLineTextTo GenerateSingleLineTextTo(FrmInfSingleLineText po, FrmUiForm form) {
		Long id = form.getId() > 0? po.getId(): 0;
		
		SingleLineTextTo to = new SingleLineTextTo();
		to.setId(id);
		to.setUid(po.getUid());			
		
		to.setCode(po.getCode());
		to.setIsRequired(po.getIsRequired());
		to.setIndexx(po.getIndexx());
		to.setStatus(po.getStatus());
		
		to.setLabel(po.getLabel());

		return to;
	}
	
	public static FrmInfSingleLineText GenerateSingleLineTextPo(JSONObject obj) {
		FrmInfSingleLineText po = new FrmInfSingleLineText();
		
		FieldOt.setUiElementProperties(po, obj);
		po.setLabel(obj.getString("label"));
		
		return po;
	}

}
